'use strict';

const Controller = require('egg').Controller;

class HomeController extends Controller {
  async index() {
    const { ctx } = this;
    ctx.body = 'hi, egg';
  }
  async dialog() {
    const { ctx } = this;
    const data = await this.app.mysql.select('send');
    console.log(data);
    if (data) {
      ctx.body = {
        code: 200,
        data,
      };
    } else {
      ctx.body = {
        code: 404,
        msg: '没有获取到数据',
      };
    }

  }

}

module.exports = HomeController;
